package com.fyzk.activity.user.accountdetail;

import android.graphics.Color;
import android.os.Bundle;
import android.support.v4.app.FragmentManager;
import android.view.View;
import android.widget.AbsListView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.fyzk.base.BaseActivity;
import com.fyzk.activity.lottery.togetherbuy.HM_VerticalPop;
import com.tyjc.lottery.R;
import com.fyzk.view.TopTitleView;


/**
 * 提现记录
 */
public class WithDrawRecordActivity extends BaseActivity implements HM_VerticalPop
        .HM_PopuponItemListener {

    private String[] popup_items = { "全部", "近一周", "近一个月","近三个月"};
    private int[] range_time = {1,2,3,4};//1全部 2一周 3一个月 4三个月

    private HM_VerticalPop top_popup;

    WithDrawRecordFragment withDrawRecordFragment;

    TopTitleView withdrawrecord_top;
    private RelativeLayout mRlBg;
    private TextView rightTxt;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.ac_withdrawrecord);
        withdrawrecord_top = (TopTitleView)findViewById(R.id.withdrawrecord_top);
        mRlBg = findViewById(R.id.rl_bg);
        rightTxt = (TextView) withdrawrecord_top.findViewById(R.id.topview_top_txt_right);
        rightTxt.setTextColor(Color.BLACK);
       // rightTxt.setTextColor(R.id.redball);

        rightTxt.setCompoundDrawablesWithIntrinsicBounds(null,null,getResources().getDrawable(R.drawable.arrow_under,null),null);
        withdrawrecord_top.setOnTitleClickListener(this);
        top_popup = new HM_VerticalPop(getContext(), AbsListView.LayoutParams.WRAP_CONTENT, AbsListView
                .LayoutParams.WRAP_CONTENT,
                popup_items);
        top_popup.setHm_PopupOnItemListener(this);
        FragmentManager fm = getSupportFragmentManager();
        withDrawRecordFragment = (WithDrawRecordFragment) fm.findFragmentById(R.id.fg_withdrawrecord);
    }

    @Override
    public void onItem(int position) {
        withdrawrecord_top.setRightTxt(popup_items[position]);
        withDrawRecordFragment.request_accountDetailTimeRange(range_time[position]);
    }

    @Override
    public void onRightClick() {
        super.onRightClick();
        top_popup.showPopupWindow(rightTxt);
    }

    @Override
    public void popupShow() {
        mRlBg.setVisibility(View.VISIBLE);
    }

    @Override
    public void popupDismiss() {
        mRlBg.setVisibility(View.GONE);
    }
}
